﻿Imports System.Data.OleDb
Imports LecturerAppointmentSystem.UserDetails
Public Class BookAppointment
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Function btn_Search_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_Search.Click
        Dim tutorName As String = tb_Search.Text.Trim()
        Dim tutorsWithFreeSlots As New List(Of String)
        Dim sql As String = "SELECT Lecturer FROM Appointments WHERE Booked = @Booked"
        Dim cmd As OleDbCommand = New OleDbCommand(sql, conn)
        conn.Open()
        cmd.Parameters.AddWithValue("@Booked", 0)
        Dim dbread As OleDbDataReader = cmd.ExecuteReader()
        While dbread.Read()
            tutorsWithFreeSlots.Add(dbread("Lecturer"))
        End While
        conn.Close()
        Return tutorsWithFreeSlots.ToArray()
    End Function
End Class